Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
receiver_port.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_pipeline/receiver_port.h
10//! @brief Receiver port pipeline.
11
12#ifndef ROC_PIPELINE_RECEIVER_PORT_H_
13#define ROC_PIPELINE_RECEIVER_PORT_H_
14
15#include "roc_core/iallocator.h"
16#include "roc_core/list_node.h"
17#include "roc_core/refcnt.h"
18#include "roc_core/unique_ptr.h"
19#include "roc_packet/iparser.h"
20#include "roc_pipeline/config.h"
21#include "roc_rtp/format_map.h"
22#include "roc_rtp/parser.h"
23
24namespace roc {
25namespace pipeline {
26
27//! Receiver port pipeline.
28//! @remarks
29//! Created at the receiver side for every listened port.
30class ReceiverPort : public core::RefCnt<ReceiverPort>, public core::ListNode {
31public:
32 //! Initialize.
34 const rtp::FormatMap& format_map,
35 core::IAllocator& allocator);
36
37 //! Check if the port pipeline was succefully constructed.
38 bool valid() const;
39
40 //! Get port config.
41 const PortConfig& config() const;
42
43 //! Try to handle packet on this port.
44 //! @returns
45 //! true if the packet is dedicated for this port
46 bool handle(packet::Packet& packet);
47
48private:
49 friend class core::RefCnt<ReceiverPort>;
50
51 void destroy();
52
53 core::IAllocator& allocator_;
54
55 const PortConfig config_;
56
57 packet::IParser* parser_;
58
61};
62
63} // namespace pipeline
64} // namespace roc
65
66#endif // ROC_PIPELINE_RECEIVER_PORT_H_
Memory allocator interface.
Definition: iallocator.h:23
Base class for list element.
Definition: list_node.h:26
Base class for reference countable objects.
Definition: refcnt.h:25
Unique ownrship pointer.
Definition: unique_ptr.h:27
Packet parser interface.
Definition: iparser.h:22
Receiver port pipeline.
Definition: receiver_port.h:30
const PortConfig & config() const
Get port config.
ReceiverPort(const PortConfig &config, const rtp::FormatMap &format_map, core::IAllocator &allocator)
Initialize.
bool handle(packet::Packet &packet)
Try to handle packet on this port.
bool valid() const
Check if the port pipeline was succefully constructed.
RTP payload format map.
Definition: format_map.h:22
RTP payload format map.
Memory allocator interface.
Packet parser interface.
Linked list node.
Root namespace.
Base class for reference countable objects.
Pipeline config.
RTP packet parser.
Port parameters.
Definition: config.h:56
Unique ownrship pointer.